<template>
	<!-- 毛巾列表 -->
	<view class="background">
		<!-- 顶部 -->
		<view class="shop-title f-color">
			<view class="shop-item">
				<view>价格</view>
				<view class='shop-icon'>
					<view class="iconfont icon-shangjiantou up"></view>
					<view class="iconfont icon-xiajiantou down"></view>
				</view>
			</view>
			<view class="shop-item">
				<view>折扣</view>
				<view class='shop-icon'>
					<view class="iconfont icon-shangjiantou up"></view>
					<view class="iconfont icon-xiajiantou down"></view>
				</view>
			</view>
			<view class="shop-item">
				<view>品牌</view>
				<view class='shop-icon'>
					<view class="iconfont icon-shangjiantou up"></view>
					<view class="iconfont icon-xiajiantou down"></view>
				</view>
			</view>
		</view>
		<Lines />

		<!-- 商品列表 -->
		<!-- 商品列表组件 -->
		<view class='shop-list'>
			<view class='shop' v-for="(item, index) in dataList" :key="index" @tap='goDetails(item.id)'>
				<view class="shop-container">
					<image class='shop-img' :src="item.imgUrl" mode=""></image>
					<view class='shop-content'>
						<text class='shop-name'>{{ item.name }}</text>
						<view class="shop-prices">
							<text class='price'>¥{{ item.price }}</text>
							<text class='oprice'>¥{{item.oprice}}</text>
						</view>
						<text class='discount'>{{item.discount}}折</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Lines from '@/components/common/Lines.vue'
	export default {
		data() {
			return {
				dataList: [{
						id: 1,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_1.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "699",
						discount: "4.5"
					},
					{
						id: 2,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_2.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "799",
						discount: "5.2"
					},
					{
						id: 3,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_3.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "399",
						oprice: "899",
						discount: "5.2"
					},
					{
						id: 4,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_4.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					},
					{
						id: 5,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_5.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					},
					{
						id: 6,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_1.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					},
					{
						id: 7,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_2.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					},
					{
						id: 8,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_3.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					},
					{
						id: 9,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_4.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					},
					{
						id: 10,
						imgUrl: "../../static/img/fenlei-img/fenye/baihuo/list1_5.png",
						name: "大衣绒毛大款2024年必买，不买就错过啦，爆款甩卖GG008",
						price: "299",
						oprice: "999",
						discount: "2.5"
					}
				]
			}
		},
		components: {
			Lines
		},
		methods: {
			goDetails(id) {
				uni.navigateTo({
					url: '../../pages/details/details?id=' + id + ''
				})
			}
		}
	}
</script>

<style scoped>
	/* 页面背景 */
	.background {
		background-image: url("http://5b0988e595225.cdn.sohucs.com/images/20200214/b10c23d5aa5a444da21bc6058475cc1f.jpeg");
		/* 覆盖整个背景区域 */
		background-size: cover;
		/* 背景图片居中显示 */
		background-position: center;
	}

	.shop-title {
		display: flex;
	}

	.shop-item {
		flex: 1;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 40px;
	}

	.shop-icon {
		position: relative;
		margin-left: 5px;
	}

	.iconfont {
		width: 6px;
		height: 4px;
		position: absolute;
		left: 0;
	}

	.up {
		top: -10px;
	}

	.down {
		top: -5px;
	}

	/* 页面布局 */
	.shop-list {
		display: flex;
		flex-wrap: nowrap;
		justify-content: space-between;
		width: 100%;
	}

	.shop {
		width: 48%;
		box-sizing: border-box;
		padding: 10px;
		margin-right: 2%;
	}

	.shop:nth-child(2n) {
		margin-right: 0;
	}

	.shop-img {
		width: 100%;
		height: 160px;
		border: 1px solid yellowgreen;
		/* 添加圆角 */
		border-radius: 10px;
		/* 添加阴影效果 */
		box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
	}

	.shop-content {
		text-align: center;
	}

	.shop-name {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		color: #333333;
		word-break: break-all;
		padding: 2px 8px;
		font-size: 12px;
		/* 调整行高 */
		line-height: 1.2;
		/* 增加字间距 */
		letter-spacing: 0.3px;
	}

	.oprice {
		text-decoration: line-through;
		font-size: 12px;
		color: #999999;
	}

	.discount {
		border-radius: 2px;
		border: 1px solid #FF3333;
		padding: 1px 5px;
		font-size: 10px;
		color: #FF3333;
	}
</style>